package link.anyauto.weclass.base;

import android.app.Application;
import android.graphics.drawable.Drawable;
import android.os.Build;

/**
 * Created by discotek on 17-2-9.
 */

public class App extends Application {
    static App instance;
    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
    }

    public static String getStr(int resId) {
        return instance.getString(resId);
    }

    public static String getStr(int resId, Object ... args) {
        return instance.getString(resId, args);
    }

    public static App getInstance() {
        return instance;
    }

    public static Drawable getDraw(int resId) {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return instance.getResources().getDrawable(resId, instance.getTheme());
        } else {
            return instance.getResources().getDrawable(resId);
        }
    }
}
